Imports System 
Imports System.Text 
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Configuration 
Imports System.Xml 
Imports System.Xml.Serialization
Imports SubSonic 
Imports SubSonic.Utilities
Namespace Data
    ''' <summary>
    ''' Strongly-typed collection for the VwAspnetUsers class.
    ''' </summary>
    <Serializable()> _
    Public Partial Class VwAspnetUsersCollection 
    Inherits ReadOnlyList(Of VwAspnetUsers, VwAspnetUsersCollection)       
        Public Sub New()
        End Sub
    End Class
    ''' <summary>
    ''' This is  Read-only wrapper class for the vw_aspnet_Users view.
    ''' </summary>
    <Serializable()> _
    Public Partial Class VwAspnetUsers 
    Inherits ReadOnlyRecord(Of VwAspnetUsers)
    
	    #Region "Default Settings"
	    Protected Shared Sub SetSQLProps()
	        GetTableSchema()
	    End Sub
	    #End Region
        #Region "Schema Accessor"
        Public Shared ReadOnly Property Schema() As TableSchema.Table
            Get
                If (BaseSchema Is Nothing) Then
                    SetSQLProps()
                End If
                Return BaseSchema
            End Get
        End Property
	    
	    Private Shared Sub GetTableSchema()
	        If (Not IsSchemaInitialized) Then
	            'Schema declaration
				Dim schema As TableSchema.Table = New TableSchema.Table("vw_aspnet_Users", TableType.View, DataService.GetInstance("ClubStarterKitData"))
				schema.Columns = New TableSchema.TableColumnCollection()
				schema.SchemaName = "dbo"
                
                'Columns
                
                Dim colvarApplicationId As New TableSchema.TableColumn(schema)
                colvarApplicationId.ColumnName = "ApplicationId"
                colvarApplicationId.DataType = DbType.Guid
                colvarApplicationId.MaxLength = 0
                colvarApplicationId.AutoIncrement = False
                colvarApplicationId.IsNullable = false
                colvarApplicationId.IsPrimaryKey = False
                colvarApplicationId.IsForeignKey = False
                colvarApplicationId.IsReadOnly = false
                 
                schema.Columns.Add(colvarApplicationId)
                
                Dim colvarUserId As New TableSchema.TableColumn(schema)
                colvarUserId.ColumnName = "UserId"
                colvarUserId.DataType = DbType.Guid
                colvarUserId.MaxLength = 0
                colvarUserId.AutoIncrement = False
                colvarUserId.IsNullable = false
                colvarUserId.IsPrimaryKey = False
                colvarUserId.IsForeignKey = False
                colvarUserId.IsReadOnly = false
                 
                schema.Columns.Add(colvarUserId)
                
                Dim colvarUserName As New TableSchema.TableColumn(schema)
                colvarUserName.ColumnName = "UserName"
                colvarUserName.DataType = DbType.String
                colvarUserName.MaxLength = 256
                colvarUserName.AutoIncrement = False
                colvarUserName.IsNullable = false
                colvarUserName.IsPrimaryKey = False
                colvarUserName.IsForeignKey = False
                colvarUserName.IsReadOnly = false
                 
                schema.Columns.Add(colvarUserName)
                
                Dim colvarLoweredUserName As New TableSchema.TableColumn(schema)
                colvarLoweredUserName.ColumnName = "LoweredUserName"
                colvarLoweredUserName.DataType = DbType.String
                colvarLoweredUserName.MaxLength = 256
                colvarLoweredUserName.AutoIncrement = False
                colvarLoweredUserName.IsNullable = false
                colvarLoweredUserName.IsPrimaryKey = False
                colvarLoweredUserName.IsForeignKey = False
                colvarLoweredUserName.IsReadOnly = false
                 
                schema.Columns.Add(colvarLoweredUserName)
                
                Dim colvarMobileAlias As New TableSchema.TableColumn(schema)
                colvarMobileAlias.ColumnName = "MobileAlias"
                colvarMobileAlias.DataType = DbType.String
                colvarMobileAlias.MaxLength = 16
                colvarMobileAlias.AutoIncrement = False
                colvarMobileAlias.IsNullable = true
                colvarMobileAlias.IsPrimaryKey = False
                colvarMobileAlias.IsForeignKey = False
                colvarMobileAlias.IsReadOnly = false
                 
                schema.Columns.Add(colvarMobileAlias)
                
                Dim colvarIsAnonymous As New TableSchema.TableColumn(schema)
                colvarIsAnonymous.ColumnName = "IsAnonymous"
                colvarIsAnonymous.DataType = DbType.Boolean
                colvarIsAnonymous.MaxLength = 0
                colvarIsAnonymous.AutoIncrement = False
                colvarIsAnonymous.IsNullable = false
                colvarIsAnonymous.IsPrimaryKey = False
                colvarIsAnonymous.IsForeignKey = False
                colvarIsAnonymous.IsReadOnly = false
                 
                schema.Columns.Add(colvarIsAnonymous)
                
                Dim colvarLastActivityDate As New TableSchema.TableColumn(schema)
                colvarLastActivityDate.ColumnName = "LastActivityDate"
                colvarLastActivityDate.DataType = DbType.DateTime
                colvarLastActivityDate.MaxLength = 0
                colvarLastActivityDate.AutoIncrement = False
                colvarLastActivityDate.IsNullable = false
                colvarLastActivityDate.IsPrimaryKey = False
                colvarLastActivityDate.IsForeignKey = False
                colvarLastActivityDate.IsReadOnly = false
                 
                schema.Columns.Add(colvarLastActivityDate)
                
                BaseSchema = schema
				
				'add this schema to the provider
                'so we can query it later
                DataService.Providers("ClubStarterKitData").AddSchema("vw_aspnet_Users",schema)
	        End If
	    End Sub
	    #End Region
	    
        #Region "Query Accessor"
        Public Shared Function CreateQuery As Query
            Return New Query(Schema)
        End Function
	    #End Region
	    
	    #Region ".ctors"
	    Public Sub New()
	        SetSQLProps()
            SetDefaults()
            MarkNew()
	    End Sub
	    
		Public Sub New(ByVal useDatabaseDefaults As Boolean)
			SetSQLProps()
			If useDatabaseDefaults = True Then
				ForceDefaults()
			End If
			MarkNew()
		End Sub
		
	    Public Sub New(ByVal keyID As Object)
	        SetSQLProps()
		    LoadByKey(keyID)
	    End Sub
    	
    	Public Sub new(ByVal columnName As String, ByVal columnValue As Object)
    	    SetSQLProps()
            LoadByParam(columnName , columnValue)
    	End Sub
	    #End Region
	    
	    #Region "Props"
	      
        <XmlAttribute("ApplicationId")> _
        Public Property ApplicationId() As Guid 
		    Get
			    Return GetColumnValue(Of Guid)("ApplicationId")
			End Get
            Set(ByVal value As Guid)
			    SetColumnValue("ApplicationId", value)
            End Set
        End Property
	      
        <XmlAttribute("UserId")> _
        Public Property UserId() As Guid 
		    Get
			    Return GetColumnValue(Of Guid)("UserId")
			End Get
            Set(ByVal value As Guid)
			    SetColumnValue("UserId", value)
            End Set
        End Property
	      
        <XmlAttribute("UserName")> _
        Public Property UserName() As String 
		    Get
			    Return GetColumnValue(Of String)("UserName")
			End Get
            Set(ByVal value As String)
			    SetColumnValue("UserName", value)
            End Set
        End Property
	      
        <XmlAttribute("LoweredUserName")> _
        Public Property LoweredUserName() As String 
		    Get
			    Return GetColumnValue(Of String)("LoweredUserName")
			End Get
            Set(ByVal value As String)
			    SetColumnValue("LoweredUserName", value)
            End Set
        End Property
	      
        <XmlAttribute("MobileAlias")> _
        Public Property MobileAlias() As String 
		    Get
			    Return GetColumnValue(Of String)("MobileAlias")
			End Get
            Set(ByVal value As String)
			    SetColumnValue("MobileAlias", value)
            End Set
        End Property
	      
        <XmlAttribute("IsAnonymous")> _
        Public Property IsAnonymous() As Boolean 
		    Get
			    Return GetColumnValue(Of Boolean)("IsAnonymous")
			End Get
            Set(ByVal value As Boolean)
			    SetColumnValue("IsAnonymous", value)
            End Set
        End Property
	      
        <XmlAttribute("LastActivityDate")> _
        Public Property LastActivityDate() As DateTime 
		    Get
			    Return GetColumnValue(Of DateTime)("LastActivityDate")
			End Get
            Set(ByVal value As DateTime)
			    SetColumnValue("LastActivityDate", value)
            End Set
        End Property
	    
	    #End Region
    
	    #Region "Columns Struct"
	    Public Structure Columns
			Dim x as Integer
	        
            Public Shared ApplicationId As String = "ApplicationId"
            
            Public Shared UserId As String = "UserId"
            
            Public Shared UserName As String = "UserName"
            
            Public Shared LoweredUserName As String = "LoweredUserName"
            
            Public Shared MobileAlias As String = "MobileAlias"
            
            Public Shared IsAnonymous As String = "IsAnonymous"
            
            Public Shared LastActivityDate As String = "LastActivityDate"
            
	    End Structure
	    #End Region
    End Class
End Namespace
